#include "Blocks/ThermometerBlock.h"

namespace PocketSurvival
{
    int32_t ThermometerBlock::getIndex()
    {
        return Index();
    }
    const std::string &ThermometerBlock::getBlockName()
    {
        static std::string blockName = "ThermometerBlock";
        return blockName;
    }

    const std::vector<BoundingBox> &ThermometerBlock::getCustomCollisionBoxes(int32_t value)
    {
		int32_t num = Terrain::ExtractData(value);
		if (num < 4)
		{
			return BlockConstans::thermometerCollisionBoxes[num];
		}
		return BlockConstans::defaultCollisionBoxes;
    }

    BlockPlacementData ThermometerBlock::getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult)
    {
		int32_t value2 = 0;
		if (raycastResult.cellFace.face == 0)
		{
			value2 = Terrain::ReplaceData(Index(), 0);
		}
		if (raycastResult.cellFace.face == 1)
		{
			value2 = Terrain::ReplaceData(Index(), 1);
		}
		if (raycastResult.cellFace.face == 2)
		{
			value2 = Terrain::ReplaceData(Index(), 2);
		}
		if (raycastResult.cellFace.face == 3)
		{
			value2 = Terrain::ReplaceData(Index(), 3);
		}
		BlockPlacementData result;
		result.value = value2;
		result.cellFace = raycastResult.cellFace;
		return result;
    }

} // namespace PocketSurvival

